package com.zhuiyun.project.api.recording.controller;

import com.zhuiyun.project.api.recording.model.TransactionHistoryModel;
import com.zhuiyun.project.api.recording.service.TransactionHistoryService;
import com.zhuiyun.project.common.errorCode.CommonException;
import com.zhuiyun.project.common.response.CommonResult;
import com.zhuiyun.project.util.pageUtil.PageRequest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName TransactionHistoryController
 * @Description TODO
 * @Author 李中博
 * @Date 2024/9/24 20:35
 **/
@RestController
@Api(tags = "交易记录")
@RequestMapping("/transactionHistory")
@CrossOrigin
@Slf4j
public class TransactionHistoryController {
    @Autowired
    private TransactionHistoryService transactionHistoryService;
    /**
     * 查询交易记录
     * @param
     * @return
     */
    @GetMapping("/getTransactionHistoryByPage")
    @ApiOperation(value = "交易记录的分页查询方法")
    public CommonResult getTransactionHistoryByPage(String userName, PageRequest pageRequest) throws CommonException {
        return transactionHistoryService.getTransactionHistoryByPage(userName,pageRequest);
    }
    @GetMapping("/getTransactionHistoryById")
    @ApiOperation(value = "交易记录的分页查询方法")
    public CommonResult getTransactionHistoryById(Integer productId)  {
        return transactionHistoryService.getTransactionHistoryById(productId);
    }
}
